﻿package  
{
	import fl.motion.Color;
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFormat;
	
	/**
	 * ...
	 * @author ...
	 */
	public class console 
	{
		public var m_consoleText:TextField;
		
		
		public function console(screen:Sprite) 
		{
			m_consoleText = new TextField();
			screen.addChild(m_consoleText);
			
			var consoleTextFormat:TextFormat = new TextFormat();
			//consoleTextFormat.font = "TimesNewRoman";
			consoleTextFormat.size = 10;
			consoleTextFormat.align = "left";
			consoleTextFormat.color = 0x99FF99;
			
			m_consoleText.selectable = false;
			m_consoleText.border = false;
			m_consoleText.y = 5;
			m_consoleText.width = 470;
			m_consoleText.height = 400;
			m_consoleText.setTextFormat(consoleTextFormat);			
		}
		
		public function write(message:String):void
		{
			m_consoleText.appendText(message + "\n");
			var lines:Array = m_consoleText.text.split("\r");
			if (lines.length > 25)
			{
				m_consoleText.text = m_consoleText.text.substr(lines[0].length + 1);
			}
		}
		
	}
	
}